{include file="public/head" /}
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-row">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">修改密码</li>
            </ul>
        </div>
        <div class="layui-col-md4">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" lay-verify="required" autocomplete="off"
                               placeholder="请输入用户名"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">旧密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="oldPassword" lay-verify="required" placeholder="请输入旧密码"
                               autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="newPassword" lay-verify="required" placeholder="请输入新密码"
                               autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item" style="text-align: center">
                    <a class="layui-btn" lay-submit="" lay-filter="changePassword">提交</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.use('form', function () {
        var form = layui.form, layer = layui.layer;
        //表单提交
        form.on('submit(changePassword)', function (data) {
            $.post("{:url('admin/Index/changePasswordPost')}", {data: data.field}, function (res) {
                if (res.code == 0) {
                    layer.msg(res.msg, {time: 2000, icon: 5});
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 6});
                    $("input").val('');
                }
            }, "json");
        });

    });
</script>
</body>
</html>